<link href="/theme/Default/css/member/manage.css" rel="stylesheet">
<div class="manage-content">
	<h3>Danh sách sản phẩm</h3>
	<hr>
	<a href="/quan-ly-user/san-pham/them-san-pham" class="btn btn-success">Thêm sản phẩm</a>
	<br><br>
	<?php if(count($data)>0){?>
		<table border="1" style="width:100%" class="table table-bordered table-striped table-hover"> 
		 <thead>
			  <tr>
			     <th>STT</th>
			     <th>Tên sản phẩm</th>
			     <th>Giá</th>
			     <th>Hình ảnh</th>
			     <th>Chỉnh sửa</th>
			  </tr>
		 </thead>
		 <tbody>
			  <?php 
					$i=1;
					foreach($data as $item){?>
					<tr>
				 		 <td><?php echo $i;?></td>
						 <td><?php echo $item['Product']['product_name'];?></td>
						 <td><?php echo number_format($item['Product']['price']); echo $item['Product']['currency_type'] == CURRENCY_TYPE_VND? " VND":" USD"; ?></td>
						 <td><img src="/<?php echo $item['Product']['image_icon'];?>" width="50px" height="50px"/></td>
						 <td> 
						 	<a class="btn btn-success" href="/quan-ly-user/san-pham/chinh-sua/<?php echo $item['Product']['short_url'];?>">
						 		<!-- <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> -->
						 		chỉnh sửa
						 	</a>
						 	<a class="btn btn-danger" href="/quan-ly-user/san-pham/xoa/<?php echo $item['Product']['short_url'];?>" onclick="if (confirm('Bạn có muốn xóa sản phẩm ?')) { return true; } return false;">
						 		<!-- <span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> -->
						 		Xóa
						 	</a>
						 </td>
				    </tr>
				<?php 
					$i++;
			}?>
		 </tbody>
	</table>
<?php }else{
	echo "<h5>Chưa có sản phẩm nào</h5>";
}?>
	 
</div>
<div class="pagination pagination-centered">
	<?php
		if ($this -> Paginator -> counter('{:pages}') > 1){
	 		echo $this -> element('pagination', array('Paginator' => $this -> Paginator));
	 	}
 	?>
</div>
